

<template>
<div class="containerDistribution">
<div class="select-top">
  <div>集装箱可视化</div>
  <div>下拉框</div>
</div>
  <div class="content-list">
    <div>集装箱分布</div>
    <div>
      <div v-for="(item,index) in result" :key="index" class="item-row">
        <div class="row-goodsName" :style="{color:getColor(index)}">{{item.goodsName}}</div>
        <div class="row-right">
          <div v-for="(val,k) in item.containerNumList" :key="k" class="col-item" :style="{background:getColor(index)}">
            <div class="count-p">
              <div class="text">数量：</div><div class="count">{{val.num}}</div>
            </div>
            <div class="count-p">
              <div class="text">装载量：</div>
              <div class="count">{{val.loadingSum}}</div>
            </div>
            <div class="status-bubble"></div>
            <div class="status" :style="{color:getStatusColor(index)}">{{status[val.status]}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>
<script >
//集装箱分布
export default {
  name:"containerDistribution",
  data(){
    return{
      result:[
        {
          goodsName:"全部",
          containerNumList:[
            {
              loadingSum:"2000",
              num:"1500",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"硫磺",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"钙盐",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"钙盐",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"钙盐",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"钙盐",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        },
        {
          goodsName:"钙盐",
          containerNumList:[
            {
              loadingSum:"20",
              num:"15",
              status:"0"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"1"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"2"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"3"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"4"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"5"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"6"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"7"
            },
            {
              loadingSum:"20",
              num:"15",
              status:"8"
            },
          ]
        }
      ],
      styleList:["#46BFEA",'#E9AC51',"#78C950"],
      statusColor:["#005979","#704300","#1E5C00"],
      status:{
        0:"空箱",
        1:"入库重箱",
        2:"出库重箱",
        3:"待清扫",
        4:"坏箱",
        5:"已报修",
        6:"空箱在途",
        7:"重箱在途",
        8:"即将到场"
      },
    }
  },
  methods:{
    getColor(index){
      return this.styleList[index%this.styleList.length]
    },
    getStatusColor(index){
      return this.statusColor[index%this.statusColor.length]
    },
  }

}
</script>
<style scoped lang="scss">
.containerDistribution{
  font-size: 14px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  .select-top{
    background-color: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    border-radius:4px ;
  }
  .content-list{
    flex: 1;
    background-color: #fff;
    overflow: auto;
    padding: 10px;
    .item-row{
      display: flex;
      gap: 10px;
      margin: 10px 0;
      .row-goodsName{
        width: 80px;
        height: 100px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: bold;
      }
      .row-right{
        flex: 1;
        display: flex;
        gap: 10px;
      }
    }
    .col-item{
      min-width: calc(100% / 9 - 8px);
      max-width: calc(100% / 9 - 8px);
      height: 100px;
      border: 1px solid #ccc;
      display: flex;
      flex-direction: column;
      padding: 10px;
      position: relative;
      gap: 3%;
      .count-p{
        display: flex;
        align-items: center;
      }
      .count{
        font-weight: bold;
        font-size: 20px;
        color: #FFFFFF;
      }
      .text{
        font-size: 13px;
        color: #FFFFFF;
      }
      .status{
        position: absolute;
        right: 10px;
        bottom: 10px;
        color: #005979;
      }
      .status-bubble{
          position: absolute;
          right: 10px;
          bottom: 15px;
          width: 60px;
          height: 21px;
          background: url("./images/bubble.png") no-repeat;
          background-size: 100% 100%;
        }
    }
  }
}
</style>